<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/jsp/ningbo/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="format-detection" content="address=no;">
    <title> ${item_content}</title>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/jsp/ningbo/css/news.css">

</head>
<body>
<input type="hidden" id="itemValId" value="${ITEM_THIS}">
<main class="body bggray">
	<%-- <!-- head start -->
    <header id="header">
    	<span>
    	<img alt="宁波人社局" src="<%=request.getContextPath()%>/jsp/ningbo/images/top_logo.png" width="35" height="35">
    	</span>
	<h1>${item_content}</h1>
    </header>
    <!-- head end -->
    <div class="mt50"></div> --%>
    <!-- main start -->
    <div class="newsbox">   
        <ul class="list_news2"  id="thelist">
        <c:if test="${not empty newsList}">
		<c:forEach var="news" items="${newsList}">		
        	<li onClick='javascript:window.location.href="<%=request.getContextPath()%>/nbwx/m/list_detail?docid=${news.docid}"'>
            	<h3>${news.doctitle}</h3>
                <p>${news.chnlname}</p>
            	<span>${fn:substringBefore(news.docreltime,".")}</span>
            </li>
         </c:forEach> 
         </c:if>
         <c:if test="${empty newsList}">
      		暂无数据
      	</c:if> 
      	      
        </ul>
        <div class="bg_gray10"></div>
		<div class="bottom_load" id="loadMore" onclick="loadMore();">点击加载更多</div>
    </div>
    <!-- main end -->
</main>
</body>
<script type="text/javascript" src="<%=request.getContextPath()%>/jsp/ningbo/js/jquery-1.8.2.js"></script>
<script type="text/javascript">

loadMore();

var commitFlag_A = "1";
var startNum=0;
var pageSize=15;
var noDataFlag="1";//默认是还有数据
function loadMore(){
		if(commitFlag_A!="1"){
			return "";
		}
		if(noDataFlag=="2"){
			return "";
		}
		$("#loadMore").html("Loading...");
		commitFlag_A = "2";
		startNum = startNum+pageSize;
		var data = {};
		data.startNum = startNum+"";
		var showResultDataObj = $("#thelist");
		var item = $("#itemValId").val();
		$.ajax({
			url : ctxPath+'/nbwx/m/list_liebiaoMore?item='+item,
			type : 'post',
			data : data,
			dataType : 'html',
			ifModified : true,
			cache : false,
			success : function(data) {
				commitFlag_A = "1";
				data = $.parseJSON(data);
				var tempObj=eval(data.model); 
				if(tempObj.length>0){
					var htmlStr ="";
					for(var i=0;i<tempObj.length;i++){ 
						var itemInfo  = tempObj[i];
						htmlStr +="<li onClick=javascript:window.location.href='<%=request.getContextPath()%>/nbwx/m/list_detail?docid="+itemInfo.docid+"'>"; 
						htmlStr +="<h3>"+itemInfo.doctitle+"</h3>"; 
						htmlStr +="<p>"+itemInfo.chnlname+"</p>"; 	
						var docreltimeNoDot = itemInfo.docreltime.substring(0,itemInfo.docreltime.length-2);
						htmlStr +="<span>"+docreltimeNoDot+"</span>";
						htmlStr +="</li>"; 
					}
					if(tempObj.length==pageSize){
						noDataFlag="1";
						$("#loadMore").html("点击加载更多");
					}else if(tempObj.length<pageSize){
						noDataFlag="2";
						$("#loadMore").html("加载已完成!");
					}
					showResultDataObj.append(htmlStr);
				}else{
					noDataFlag="2";
				}
			}
		});   	
 }
</script>
</html>